package com.example.trb.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.example.trb.validation.DateTime;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.List;

@Data
@TableName(autoResultMap = true)
public class WorkExperience {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private Integer userId;

    @NotBlank(message = "离职时间不能为空")
    @DateTime(format = "yyyy-MM-dd", message = "离职时间的格式为yyyy-MM-dd")
    private String separationTime;

    @NotBlank(message = "工作地址不能为空")
    private String workAddress;

    @NotBlank(message = "证明人不能为空")
    private String attestor;

    @NotBlank(message = "工作职业不能为空")
    private String career;

    @NotBlank(message = "参加工作时间不能为空")
    @DateTime(format = "yyyy-MM-dd", message = "参加时间的格式为yyyy-MM-dd")
    private String participationTime;

    @Size(min = 1, message = "工作经历证明材料至少要有一个")
    @Size(max = 3, message = "工作经历证明材料最多只能有三个")
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<String> materials;

    @Pattern(regexp = "待审核|未通过|已通过")
    private String status;
}
